home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / snip1292.zip / ISSHIFT.C < prev    next >
Text File  |  1992-12-26  |  902b  |  25 lines

  1. /*-------------------------[ IsShift ]--------------------------*/
  2. /*           Determine whether a shift key is depressed         */
  3. /*              public domain snippet by Jeff Dunlop            */
  4. /*--------------------------------------------------------------*/
  5. /* local:                                                       */
  6. /*      key_flags = pointer to bios shift key area              */
  7. /* return:                                                      */
  8. /*      1 if either shift key is depressed                      */
  9. /*--------------------------------------------------------------*/
  10.  
  11. #if !defined(MK_FP)
  12.     #define MK_FP(seg,off) ((void far *)(((long)(seg) << 16)|(unsigned)(off)))
  13. #endif
  14.  
  15. int IsShift(void)
  16. {
  17.     unsigned char far *keyflags = MK_FP(0x40, 0x17);
  18.  
  19.     return (*keyflags & 0x03);
  20. }
  21.  
  22. /* -or?- */
  23.  
  24. #define IsShift ((*MK_FP(0x40, 0x17)) & 0x03)
  25.